#!/bin/bash

P=$1

# i386/Linux, x86-64/Linux, ppc/Linux, ppc64/Linux
if [ ${P/linux/} != ${P} ]; then
if [ ${P/i686/} != ${P} ]; then
PLATFORM=i386-unknown-linux2.4
fi
if [ ${P/i586/} != ${P} ]; then
PLATFORM=i386-unknown-linux2.4
fi
if [ ${P/i486/} != ${P} ]; then
PLATFORM=i386-unknown-linux2.4
fi
if [ ${P/i386/} != ${P} ]; then
PLATFORM=i386-unknown-linux2.4
fi
if [ ${P/x86_64/} != ${P} ]; then
PLATFORM=x86_64-unknown-linux2.4
fi
if [ ${P/ppc64/} != ${P} ]; then
PLATFORM=ppc64_linux
fi
if [ ${P/powerpc64/} != ${P} ]; then
PLATFORM=ppc64_linux
fi
if [ ${P/powerpc-/} != ${P} ]; then
PLATFORM=ppc32_linux
fi
if [ ${P/ppc-/} != ${P} ]; then
PLATFORM=ppc32_linux
fi
if [ ${P/aarch64-/} != ${P} ]; then
PLATFORM=aarch64-unknown-linux
fi
# Freebsd
elif [ ${P/freebsd/} != ${P} ]; then
if [ ${P/i686/} != ${P} ]; then
PLATFORM=i386-unknown-freebsd7.2
fi
if [ ${P/i586/} != ${P} ]; then
PLATFORM=i386-unknown-freebsd7.2
fi
if [ ${P/i486/} != ${P} ]; then
PLATFORM=i386-unknown-freebsd7.2
fi
if [ ${P/i386/} != ${P} ]; then
PLATFORM=i386-unknown-freebsd7.2
fi
if [ ${P/x86_64/} != ${P} ]; then
PLATFORM=amd64-unknown-freebsd7.2
fi


# VxWorks
elif [ ${P/vxworks/} != ${P} ]; then
if [ ${P/i686/} != ${P} ]; then
PLATFORM=i386-unknown-vxworks6.x
fi
if [ ${P/i586/} != ${P} ]; then
PLATFORM=i386-unknown-vxworks6.x
fi
if [ ${P/i486/} != ${P} ]; then
PLATFORM=i386-unknown-vxworks6.x
fi
if [ ${P/i386/} != ${P} ]; then
PLATFORM=i386-unknown-vxworks6.x
fi
if [ ${P/powerpc-/} != ${P} ]; then
PLATFORM=ppc32-unknown-vxworks6.x
fi
fi

echo $PLATFORM
